package org.ccay.core.orm;

import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.SqlSource;
import org.apache.ibatis.session.Configuration;

/**
 * 实现SqlSource接口, 用来处理&lt;addProgram &gt;Tag
 * @see org.ccay.core.orm.plugins.CdataTagInterceptor
 * 
 * @since 2011-12-14
 */
public class ExtendedSqlSource implements SqlSource {

	private Configuration configuration;

	private SqlSource delegate;

	public ExtendedSqlSource(Configuration configuration, SqlSource delegate) {
		this.configuration = configuration;
		this.delegate = delegate;
	}

	/* (non-Javadoc)
	 * @see org.apache.ibatis.mapping.SqlSource#getBoundSql(java.lang.Object)
	 */
	public BoundSql getBoundSql(Object parameterObject) {

		BoundSql boundSql = delegate.getBoundSql(parameterObject);

		return new ExtendedBoundSql(configuration, boundSql);
	}
}
